home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Collection of Tools & Utilities
/
Collection of Tools and Utilities.iso
/
pascal
/
stay42.zip
/
CLKRES.430
< prev
next >
Wrap
Text File
|
1986-08-14
|
26KB
|
516 lines
{$R+}
{$C-}
{-----------------------------------------------------------------------------}
{ " Look, Dave, I know you're trying to be helpful. But }
{ the fault is either in the ... system - or in YOUR }
{ test procedures. My information processing is perfectly }
{ normal. " }
{ Arthur C. Clark - " 2001 " }
{-----------------------------------------------------------------------------}
{ Stayres Version 4.15 }
{
Copyright (C) LaneFerris 1985,1986.
Distributed to the Public Domain for use without Profit.
A Turbo "stay-resident" program clobbers the Dos register stack. It
jumps over the Turbo run-time initialization code that would set up the
program registers and environment. Secondly, a Turbo TSR (Terminate
and stay-resident) could not ordinarily issue file I/O since that would
clobber Dos interrupt registers.
Therefore, the following code proposes an inline solution, recovering the
Turbo entry stack for "stay-resident" programs and allowing those
programs to issue Dos I/O and other interrupts.
This Turbo stay-resident demo has been put together to perform both Dos I/O
and Bios interrupts. It has been tested for re-entrancy and recursiveness
on an IBM PC with PCDOS 2.0, 2.1, 3.0, 3.1 .
R_U_N I_N_S_T_R_U_C_T_I_O_N_S
Separate the include files, compile to a COM file using STAYRES.420 (or the
current release level) as the Main file. Then execute the command file
from the DOS prompt.
Use the Turbo Compiler Options window to set the Maximum free dynamic
memory between 300-400 paragraphs. If you get $FF runtine errors or
"allocation error", "cannot load Command.Com", then adjust the mAximum free
value to something reasonable but less than your maximum memory (minus
20K). This program can ONLY run as a COM file.
Activate with the default hotkey (Alt-F9). Stayres will also free its
memory and return to Dos with the Cntl-F9 key at the last "Press a key"
prompt (Illustrated in the Stayxit routine).
The Hunter's Helper
Lane Ferris
4268 26th St
San Francisco,Ca. 94131
Compuserv 70357,2716
If you find this program useful, $15 will aid in its evolution and upkeep.
}
{ Authors: Lane Ferris (Stay Resident/Exit Code) }
{ Neil J. Rubenking (Directory code and ideas) }
{ Karson W. Morrison (Stay Resident modifications) }
{ Lynn A. Canning (Window coding revisions) }
{ Bela Lubkin (INT24 processing) }
{ Other Public Gurus on whose shoulders we stand. }
{
PURPOSE:
This code will serve as a template to create other "Stay Resident"
programs in Turbo Pascal(tm). This code intercepts Int 16,
(or INT 9) displacing the original Interrupt Vector to a Turbo inline
service procedure. During execution of other programs, it can be
invoked by the special key combination specified by "Our_HotKey"
(in this case Alt-F9.) }
{
Modifications:
7.85 - Replace Windows with a more simple form/less code.
Replace Window Array with Pointers/Heap form.
Re-issue termination Keyboard Read / pass back to user
Would like to back up Instruction Ptr by two bytes before
the Int 16 ($CD16) but it might be a "long call" by
some other Kbd interceptor (chirp chirp chrip)... and
thats "trouble in River City".
Clean up RmWin "incorrect" attribute bugs. If screen
isnt cleared, we get border attribute, not text attrb.
Remove last window at Termination Time (Ctrl-Home).
8.85 - Version 3.10 Changes
1) Save 40 words in StaySave/Rstr to avoid clobbering
Dos Stack when entering Dos with Turbo Write(ln) caused
by Int 21 Function 5 (Writln(Lst,..)) which re-issues
Int 16.
2) Change Int 68 to Int 67 to Avoid collisions with
Dos 3.1 on an AT.
3) Correct "Press a Key..." to accept any "Key..."
(not just Cr).
4) Check Int16 function. Jmp directly to Int16 if not
a character request. Avoids 40 word Save/Restore
overhead.
9.85 - Version 3.20 changes
When returning to user program, pass back a fake
"Ctrl-key" scan code to allow immediate re-execution
of the TSR (Terminate Stay Resident) program. Also
solves SideKick incessant bird caws.
9.85 - Version 3.2C
When saving/restoring the stack, save 40 words or less
depending on stack size (0-Sp = stack size) to avoid
overflowing into SS:0 when stack is less than 40 words.
Put back the "wait for user key logic" at Demo end.
Beep like SuperKick if Key is OurKey
9.85 - Version 3.31
Futz around with the "wait for user key logic", allow
the Our_key to pass, but beep user to show we aint
gonna activate, cuz our InUse bit is still set.
Clean up the documentation and duplicate instructions in
StaySave/Rstr.
Change Int67 to Int60 for Fun and Profit and get around
Mark Stanock's use of those locations.
9.85 - Version 3.32
Changes made by Karson W. Morrison
Modified the STAYRES.331 version to remove all coding
that was not necessary for the stayres routines.
The coding associated with the demo was put into
seperate include files. The coding for a revised windo.inc
file was placed into the stayres program. The windo
routines were changed to allow background and forground
colors and to allow borders of one line, two lines, or
no lines. Read the doc info. in the windo.inc file.
Revisions for the windo.inc file were made by
Lynn A. Canning. The windo routine will now allow a
window of 1,1,80,25.
10.85 - Version 3.33 l.ferris
Correct inverted parameters in Stay Windo include file
Delete unused variables and code in demo code.
Rename files to keep with Version/Release/Modification
numbering scheme.
Remove necessity for using User Interrupt locations in
low storage. Use Far calls to original interrupt.
Change Alt-F10 to Alt-F9 to avoid common conflicts.
Change Cntl-Home to Cntl-F9 keys to avoid common conflicts.
12.85 - Version 3.40 l.ferris
Clean up Window errors, add 3rd window options. Correct
Alpa/Beta errors. Say Thanks to Neil once again.
4.86 - Version 4.00
Rewrite stay-resident interface. Avoid manipulating
DOS or Users interrupted stack.
Intercepts Interrupts 9, 8, 13, 21, 28
6.86 - Replace INT 9 processing with an INT 16 equivalent.
Works better with mutitasking environments. Leave
INT 9 as an option.
- Version 4.10
Addition of Neil RubenKing's Clock Demonstration.
Great work Neil. Thanks! Co